<!DOCTYPE html>
<html>
  <head>
    <title>100以内的和</title>
  </head>
  <body>
    <div>
      <input type="text" id="one" />
      <button onclick="computNum()">反转</button>
      <input type="text" id="two" />
      <script>
        function computNum() {
          const str = document.getElementById("one").value;
          // let reversedStr = "";
          // for (let i = str.length - 1; i >= 0; i--) {
          //   reversedStr += str[i];
          // }
          // document.getElementById("two").value = reversedStr;
          document.getElementById("two").value = str
            .split("")
            .reverse()
            .join("");
        }
      </script>
    </div>
  </body>
</html>
